<script type="text/javascript" src="<?php echo base_url(); ?>static/select2/select2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/selectSearchGlobal.js"></script>
<!--
<link type="text/css" href="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.css" rel="stylesheet" /> 
<script src="<?php echo base_url(); ?>ajaxupload/jquery.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.js" type="text/javascript"></script>
-->

<script>
function appGaSave() {
            $.post("<?= site_url() ?>search_global/app_gaSave", {
                pCTab: $('#pCTab').val(),
                pCType: $('#pCType').val(),
                pCtrlID: $('#pCtrlID').val(),
                pApproval: $('#pApproval').val(),
                pNikRequestBy: $('#pNikRequestBy').val(),
                pComment: $('#pComment').val(),
                //pBudget: $('#pBudget').val()
            },
            function(data) {
                window.location = '<?php echo base_url(); ?>search_global';
            }
            );
        }
    function cancel(){
        window.location = '<?php echo base_url(); ?>search_global';
    }
</script>

<?php 
    $this->load->model('sGlobal_model');
	foreach($getDetail as $a){
        $aRmID   		= $a['RM_ID'];
    	$aRmDate  		= $a['RM_DATE'];
    	$aRmDelivery    = $a['RM_DELIVERY'];
    	$aRmTurn        = $a['RM_RETURN'];
    	$aRmType 		= $a['RM_TYPE'];
        $aRmTypeId 		= $a['MST_TYPE_ID'];
    	$aRmCategory    = $a['RM_CATEGORY'];
    	$aRmVendor		= $a['RM_VENDOR'];
    	$aRmAppAtasan   = $a['RM_ATASAN_APP'];
    	$aRmAppGa       = $a['RM_GA_APP'];
    	$aRmFloor 		= $a['RM_FLOOR'];
    	$aRmDesc        = $a['RM_DESCRIPTION'];
    	$aRmSerial		= $a['RM_SERIAL'];
    	$aRmSuite		= $a['RM_SUITE'];
    	
    	$vid 			= $a['ID'];
    	$vname 			= $a['NAME'];
    	$vorg 			= $a['ORG'];
    	$vposition 		= $a['JOB_POSITION'];
    	
    	$cNik			= $a['ID1'];
    	$cName			= $a['NAME1'];
    	$cOrg			= $a['ORG1'];
    	$cJob			= $a['JOB1'];
    
    	$zNik			= $a['RM_NIP'];
    	$zName			= $this->sGlobal_model->getName($zNik);
    	$zJob			= $this->sGlobal_model->getName($zNik);
    	$zOrg			= $this->sGlobal_model->getOrg($zNik);
        
 	}
    /*
	if(empty($org)){
		   $org = dbora_getorg("$nik");
	}*/
?>

<div id="top" >
<form id="formarea" role="form" method="post" action="" class="form-horizontal"  enctype="multipart/form-data"> 
    <input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" name="pCtrlID" />
    <input type="hidden" value="<?php echo $cType; ?>" id="pCType" name="pCType"/>
    <input type="hidden" value="<?php echo $cTab; ?>" id="pCTab" />
    <input type="hidden" value="<?php echo $zNik;?>" id="pNikRequestBy" name="pNikRequestBy"/>
<!--<div class="container">-->
	<div class="col-md-offset-0">
		<div class="col-md-11">
			<div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Request By</b></h4></div>
				<div class="panel-body">
					<div class="col-xs-12 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Nama</label>
							<div class="col-md-7">
                            <input type="text"  id="r_nama" class="select2 form-control input-sm" value="<?php echo $zName;?>" readonly=""/>
                            <!--<input type="text"  id="r_name" class="select2 form-control input-sm" value="<?php echo $zName;?>"/>--></div>
						</div>					
						<div class="form-group">
							<label class="control-label col-md-3">Nik</label>
							<div class="col-md-3">
                            <input type="text"  id="r_id" class="form-control input-sm" readonly="" value="<?php echo $zNik;?>"/></div>
						</div>
                        <div class="form-group">
							<label class="control-label col-md-3">Nama Atasan</label>
							<div class="col-md-7">
                                <input type="text" id="r_mgr" class="form-control input-sm" readonly="" value="<?php echo $cName;?>"/>
                            </div>
						</div>
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
                            <input type="text" id="r_dept" class="form-control input-sm" readonly="" value="<?php echo $zOrg;?>"/></div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
                            <input type="text" id="r_job" class="form-control input-sm" readonly="" value="<?php echo $zJob;?>"/></div>
						</div>
					</div>
				</div>
			</div>
            <div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Requestor</b></h4></div>
				<div class="panel-body">
					<div class="col-xs-12 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Nama</label>
							<div class="col-md-7">
                            <input type="text"  id="r_nama" class="select2 form-control input-sm" value="<?php echo $cName;?>" readonly=""/>
	                       </div>
                        </div>					
						<div class="form-group">
							<label class="control-label col-md-3">Nik</label>
							<div class="col-md-3">
                            <input type="text"  id="r_id" class="form-control input-sm" readonly="" value="<?php echo $cNik;?>"/>
                            </div>
						</div>
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
                            <input type="text" id="r_dept" class="form-control input-sm" readonly="" value="<?php echo $cOrg;?>"/></div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
                            <input type="text" id="r_job" class="form-control input-sm" readonly="" value="<?php echo $cJob;?>"/></div>
						</div>
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<div class="panel-heading">
					<h4 class="panel-title"><b class="caret"></b><b> Form</b></h4>
				</div>
				<div class="panel-body">
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-2">Type</label>
							<div class="col-md-4">
                            <input type="text" value="<?php echo $aRmType;?>" id="pRmType" class="form-control input-sm" readonly="" />
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">Category</label>
							<div class="col-md-7">
                            <input type="text" value="<?php echo $aRmCategory;?>" name="pRmCategory" class="form-control input-sm" readonly="" />
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">Lantai</label>
							<div class="col-md-2">
                            <input type="text" value="<?php echo $aRmFloor;?>" id="pRmFloor" class="form-control input-sm" readonly="" /></div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-2">Serial#</label>
							<div class="col-md-7"><input type="text" value="<?php echo $aRmSerial;?>" id="pRmSerial" class="form-control input-sm" readonly=""/></div>
						</div>
                        <div class="form-group">
							<label class="control-label col-md-2">Approval</label>
							<div class="col-md-7">
                                <select class="form-control input-form select2" id="pApproval" style="width:100%">
                            			<option value="Y">Approve</option>
                                        <option value="N" selected="">Disapprove</option>
    				            </select>
                            </div>
						</div>
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Request Date</label>
							<div class="col-md-4">
								<div class="input-group">
                                    <input type="text" class="form-control text-center input-sm" name="pRmDate1" id="datepicker1" value="<?php echo $aRmDelivery; ?>" readonly=""/>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Promise Date</label>
							<div class="col-md-4">
								<div class="input-group">
									<input type="text" class="form-control text-center input-sm" name="pRmDate2" id="datepicker2" value="<?php echo $aRmTurn; ?>" readonly=""/>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Description</label>
							<div class="col-md-7">
								<textarea id="pRmDesc" class="form-control input-sm" style="min-width:190px;max-width:200px;min-height:100px;max-height:200px;" readonly=""><?php echo $aRmDesc;?></textarea>
							</div>
						</div>
                        <div class="form-group">
							<label class="control-label col-md-4">Comment</label>
							<div class="col-md-7">
								<textarea id="pComment" class="form-control input-sm" style="min-width:190px;max-width:200px;min-height:100px;max-height:200px;">
                                </textarea>
							</div>
						</div>
					</div>
					
                    <div class="row"> 
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="control-label col-md-3"></label>
        						<div class="col-sm-2">
                                    <button type="button" class="btn btn-primary btn-block" onclick="appGaSave();">Submit</button>
                                </div>
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                                </div>
    				        </div>
                        </div>                   
                    </div>
				</div>
			</div>
		</div>
	</div>
<!--</div>-->
</form>
</div>